import { THEME_LAYOUT } from '../contants';
/**
 * 主题模型
 * @props priority      书籍名称
 * @props name          书籍别名
 * @props des           封面图片地址
 * @props show          书籍作者
 * @props layout        书籍描述
 * @props flush         类别
 */
export default function (app) {
  const { STRING, INTEGER, DATE, ENUM, BOOLEAN } = app.Sequelize;
  const Theme = app.model.define('theme', {
    priority: INTEGER,
    name: STRING(30),
    des: STRING,
    show: { type: BOOLEAN, defaultValue: false },
    layout: { type: ENUM, values: [Object.values(THEME_LAYOUT)] },
    flush: { type: BOOLEAN, defaultValue: true },
    createdAt: DATE,
    updatedAt: DATE
  });

  return Theme;
}
